Skip to content

feat(bevy_items): add proto-driven item definitions crate#7997

Merged
h0lybyte merged 2 commits intodevfrom
trunk/bevy-items-1773553362
Mar 15, 2026
Merged

feat(bevy_items): add proto-driven item definitions crate#7997
h0lybyte merged 2 commits intodevfrom
trunk/bevy-items-1773553362

Conversation

@h0lybyte
Copy link
Member

Summary

  • New bevy_items crate at packages/rust/bevy/bevy_items/
  • Compiles itemdb.proto → typed Rust structs via prost (codegen gated behind BUILD_PROTO env var)
  • ItemDb Bevy resource with lookups by ProtoItemId, slug, ULID, type_flags bitmask, and rarity
  • BevyItemsPlugin registers an empty ItemDb; games populate at startup via ItemDb::from_bytes() or ItemDb::from_proto()
  • Game-agnostic — reusable across isometric, discordsh, and future games
  • All proto message types derive serde for JSON serialization

Architecture

bevy_items (this PR)
├── proto::item        — prost-generated structs (Item, ItemBonuses, EquipmentInfo, etc.)
├── ItemDb             — searchable registry resource
├── ProtoItemId        — stable hash key from item slug
└── BevyItemsPlugin    — Bevy plugin entry point

bevy_inventory (existing, unchanged)
└── generic slot/stack logic — games map their ItemKind enum → ProtoItemId

Test plan

  • cargo build -p bevy_items passes
  • cargo clippy -p bevy_items — zero warnings
  • Proto codegen produces correct structs with serde derives
  • CI passes

Game-agnostic Bevy plugin that compiles itemdb.proto into typed Rust
structs via prost and wraps them in a searchable ItemDb resource.

- Proto codegen gated behind BUILD_PROTO env var (generated code committed)
- ItemDb resource with lookup by ProtoItemId, slug, ULID, type_flags, rarity
- All proto item types (Item, ItemBonuses, EquipmentInfo, UseEffect, etc.)
  derive serde for JSON serialization
- BevyItemsPlugin registers an empty ItemDb; games populate at startup
@github-actions
Copy link
Contributor

github-actions bot commented Mar 15, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 4 package(s) with unknown licenses.
See the Details below.

License Issues

packages/rust/bevy/bevy_items/Cargo.toml

PackageVersionLicenseIssue Type
bevy>= 0.18.0, < 0.19.0NullUnknown License
prost>= 0.14.0, < 0.15.0NullUnknown License
serde>= 1.0.0, < 2.0.0NullUnknown License
serde_json>= 1.0.0, < 2.0.0NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
cargo/bevy >= 0.18.0, < 0.19.0 UnknownUnknown
cargo/prost >= 0.14.0, < 0.15.0 UnknownUnknown
cargo/prost-build >= 0.14.0, < 0.15.0 UnknownUnknown
cargo/serde >= 1.0.0, < 2.0.0 UnknownUnknown
cargo/serde_json >= 1.0.0, < 2.0.0 UnknownUnknown

Scanned Files

  • packages/rust/bevy/bevy_items/Cargo.toml

Add from_json() support so any Bevy game can load items from the
Astro /api/itemdb.json endpoint with automatic string-to-enum
conversion. Add README documenting the data flow from proto to
Astro MDX to runtime ItemDb. Fix prost enum variant naming for
SkillingType and resolve all clippy warnings.
@h0lybyte h0lybyte merged commit 35172a3 into dev Mar 15, 2026
5 checks passed
@h0lybyte h0lybyte deleted the trunk/bevy-items-1773553362 branch March 15, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant